package com.ihr360.insurance.service;

import com.ihr360.commons.data.util.Pair;
import com.ihr360.commons.model.type.SIHFLedgerState;
import com.ihr360.entity.ApplicationApprovalEntity;
import com.ihr360.insurance.entity.response.BenefitApprovalResponse;
import com.ihr360.insurance.model.dto.ledger.MonthlyLedgerSummary;
import com.ihr360.rest.service.SimpleRestService;

import java.util.List;

/**
 * @author Stone.Shi
 * @description
 * @date 2018-02-13 17:22:09.
 */
public interface MonthlyLedgerSummaryService extends SimpleRestService<MonthlyLedgerSummary, Long> {

    /**
     * 根据applicationId获取某个审批中的台账id,及其userId用户
     *
     * @param companyId
     * @param applicationId
     * @return <台账id,userId>
     */
    Pair<Long, String> getLedgerSummaryUserId(String companyId, String applicationId);

    /**
     * 月度台账是否存在
     *
     * @param companyId
     * @param userId
     * @param ledgerYear
     * @param ledgerMonth
     * @return
     */
    boolean isLedgerExisted(String companyId, String userId, Integer ledgerYear, Integer ledgerMonth);

    /**
     * 获取月度台账是否已锁定
     *
     * @param companyId
     * @param userId
     * @param ledgerYear
     * @param ledgerMonth
     * @return
     */
    boolean isLedgerLocked(String companyId, String userId, Integer ledgerYear, Integer ledgerMonth);
    /**
     * 获取月度台账
     *
     * @param companyId
     * @param userId
     * @param ledgerYear
     * @param ledgerMonth
     * @return
     */
    MonthlyLedgerSummary getLedgerSummary(String companyId, String userId, Integer ledgerYear, Integer ledgerMonth);

    /**
     * 创建月度台账
     *
     * @param companyId
     * @param userId
     * @param ledgerYear
     * @param ledgerMonth
     * @return
     */
    MonthlyLedgerSummary createLedgerSummary(String companyId, String userId, Integer ledgerYear, Integer ledgerMonth);

    /**
     * 保存月度台账
     *
     * @param ledgerSummary
     */
    void saveLedgerSummary(MonthlyLedgerSummary ledgerSummary);

    /**
     * 根据审批applicationId查询账期信息
     */
    List<BenefitApprovalResponse> queryApprovalBenefit(String companyId, List<String> applicationIdList);

    /**
     * 提请审批保存审批id，状态
     */
    void saveApprovalApplicationId(String companyId, ApplicationApprovalEntity entity, Long id);

    /**
     * 审批同步修改账期状态
     */
    void updateApprovalState(String companyId, String applicationId, SIHFLedgerState state);

    /**
     * 福利账期关账
     * */
    void closeLedgerSummary(Long id);
}
